package com.example.diagnodroid.connexion;

import java.util.Set;

import com.example.diagnodroid.R;
import com.example.diagnodroid.R.id;
import com.example.diagnodroid.R.layout;

import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.IntentFilter;
import android.os.Bundle;
import android.widget.TextView;

public class BluetoothActivity extends Activity {
	
	BluetoothTracker bluetooth;
	TextView bluetoothInfoText;
	TextView bluetoothMyInfoText;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.bluetooth_layout);

		bluetoothInfoText = (TextView) findViewById(R.id.bluetooth_info);
		bluetoothMyInfoText = (TextView) findViewById(R.id.info_mobile);
		
		bluetooth = new BluetoothTracker(this);
		
		bluetoothMyInfoText.append(" nom : " + bluetooth.bluetoothAdapter.getName() + "\n adresse : " + bluetooth.bluetoothAdapter.getAddress()
				+ "\n statut : " + bluetooth.bluetoothAdapter.getState());
		
		Set<BluetoothDevice> bluetooth_dispos = bluetooth.bluetoothAdapter.getBondedDevices();
		
		if (bluetooth_dispos.size() > 0) {
		      for (BluetoothDevice bluetooth_dispo : bluetooth_dispos) {
		    	 bluetoothInfoText.append("\n nom : " + bluetooth_dispo.getName() + "\n adresse : " + bluetooth_dispo.getAddress() 
		    			 + "\n statut : " + bluetooth_dispo.getBondState() + "\n");
		    	 
		      }
		}
	}
		
	@Override
	protected void onResume() {
		super.onResume();
	}

	@Override
	protected void onStop() {
		super.onStop();
	}	

}
